﻿#include "frmmain.h"
#include <QApplication>
#include <QTextCodec>
#include "quiwidget.h"

int main(int argc, char *argv[])
{

#if (QT_VERSION >= QT_VERSION_CHECK(5,6,0))
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
    QApplication a(argc, argv);

#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
#if _MSC_VER
    QTextCodec *codec = QTextCodec::codecForName("gbk");
#else
    QTextCodec *codec = QTextCodec::codecForName("utf-8");
#endif
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForTr(codec);
#else
    QTextCodec *codec = QTextCodec::codecForName("utf-8");
    QTextCodec::setCodecForLocale(codec);
#endif

    a.setWindowIcon(QIcon(":/logo.ico"));
    a.setOrganizationName("MyApi");
    a.setApplicationVersion("1.0.0.0");
    a.setFont(QFont("Microsoft Yahei", 9));

    QString title = QString("system");
    a.setApplicationDisplayName(title);

    //读取配置文件
//    QUIConfig().Config();

    QUIWidget qui;
    frmMain *creator = new frmMain;

    //设置主窗体
    qui.setMainWidget(creator);
    QObject::connect(&qui, SIGNAL(changeStyle(QString)), creator, SLOT(changeStyle(QString)));

    //设置标题
    qui.setTitle("HTTP Server后台服务器 (作者: 燕云十三  QQ: 1007446892)");

    //设置标题文本居中
     qui.setAlignment(Qt::AlignCenter);

     //设置窗体可拖动大小
//     qui.setSizeGripEnabled(true);

     //设置换肤下拉菜单可见
     qui.setVisible(QUIWidget::BtnMenu, true);

     //设置标题栏高度
     //qui.setTitleHeight(50);

     //设置按钮宽度
     //qui.setBtnWidth(50);

     //设置左上角图标-图形字体
     qui.setIconMain(QChar(0xf099), 11);

     //设置左上角图标-图片文件
     qui.setPixmap(QUIWidget::Lab_Ico, ":/logo.ico");

     qui.show();

    return a.exec();

}
